﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MySql.Data.MySqlClient;

namespace Controller
{
    public class connetc
    {
        public static MySqlConnection conn()
        {
            MySqlConnection con = new MySqlConnection("Server=localhost;Database=lophoc;Port=3306;User ID=root;Password=");
            return con;
        }
    }
    public class khachhang_MainProcess
    {
        public static DataTable Dsachkhachhang()
        {
            MySqlConnection cn = connetc.conn();
            MySqlCommand cmdkhachhang = new MySqlCommand("Select * from danhsachlop", cn);
            MySqlDataAdapter da = new MySqlDataAdapter(cmdkhachhang);
            DataTable dtb = new DataTable();
            da.Fill(dtb);
            return dtb;
 
        }
        public static DataTable timkiem(string tenkhach)
        {
            MySqlConnection cn = connetc.conn();
            string sql = "select * from  where ='" + tenkhach + "'";
            MySqlCommand cmdSelect = new MySqlCommand(sql, cn);
            MySqlDataAdapter khachtim = new MySqlDataAdapter(cmdSelect);
            DataTable dtb = new DataTable();
            khachtim.Fill(dtb);
            return dtb;
        }
    }
}
